Better Type-Error Messages Through Lazy Typing

نویسندگان

  • Sheng Chen
  • Martin Erwig
چکیده

Producing precise and helpful error messages for type inference is still a challenge for implementations of functional languages. Current approaches often lack precision in terms of locating the origins of type errors. Moreover, suggestions for how to fix type errors that are offered by some tools are also often vague or incorrect. To address this problem we have developed a new approach to identifying type errors that is based on delaying typing decisions and systematically gathering context information to support the delayed decision making. Our technique, which we call lazy typing, is based on explicitly representing conflicting types and type errors in choice types that will be accumulated during the typing process. The structure of these types is then analyzed to produce error messages and, in many cases, also type-change suggestions. We will demonstrate that lazy typing is often more precise in locating type errors than existing tools and that it can also produce good type-change suggestions. We do not consider lazy typing as a replacement for other techniques, but rather as an addition that could help improve other approaches.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Repairing type errors in functional programs

Type systems for programming languages can be used by compilers to reject programs which are found to be potentially unsound and which may, therefore, fail to execute successfully. When a program is rejected the programmer must repair it so that it can be type-checked correctly and then executed safely. Diagnostic error messages are essential to help the programmer repair the program. Hindley-M...

متن کامل

A Declarative Debugging System for Lazy Functional Logic Programs

We present a declarative debugger for lazy functional logic programs with poly-morphic type discipline. Whenever a computed answer is considered wrong by theuser (error symptom), the debugger locates a program fragment (function definingrule) responsible for the error. The notions of symptom and error have a declara-tive meaning w.r.t. to an intended program semantics. Debug...

متن کامل

Streaming Validation of Schemata: the Lazy Typing Discipline

Assertions, identity constraints, and conditional type assignments are (planned) features of XML Schema which rely on XPath evaluation to various ends. The allowed XPath subset exploitable in those features is trimmed down for streamability concerns partly understandable (the apparent wish to avoid buffering to determine the evaluation of an expression) and partly artificial. In this paper we d...

متن کامل

On Practical SMT-Based Type Error Localization

Compilers for statically typed functional programming languages are notorious for generating confusing type error messages. When the compiler detects a type error, it typically reports the program location where the type checking failed as the source of the error. Since other error sources are not even considered, the actual root cause is often missed. A more adequate approach is to consider al...

متن کامل

Practical SMT-Based Type Error Localization Extended Version

Compilers for statically typed functional programming languages are notorious for generating confusing type error messages. When the compiler detects a type error, it typically reports the program location where the type checking failed as the source of the error. Since other error sources are not even considered, the actual root cause is often missed. A more adequate approach is to consider al...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2013